package com.sdu.cloudservice.entity;

import javax.persistence.*;
import java.util.Objects;

/**
 * Create by zekdot on 19-7-1.
 */
public class PredictPriceEntity {
    private String zoneId;
    private String instanceId;
    private String time;
    private double spot;
    private int algType;
    private int status;

    @Id
    @Column(name = "zone_id")
    public String getZoneId() {
        return zoneId;
    }

    public void setZoneId(String zoneId) {
        this.zoneId = zoneId;
    }

    @Id
    @Column(name = "instance_id")
    public String getInstanceId() {
        return instanceId;
    }

    public void setInstanceId(String instanceId) {
        this.instanceId = instanceId;
    }

    @Id
    @Column(name = "time")
    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    @Basic
    @Column(name = "spot")
    public double getSpot() {
        return spot;
    }

    public void setSpot(double spot) {
        this.spot = spot;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PredictPriceEntity that = (PredictPriceEntity) o;
        return Double.compare(that.spot, spot) == 0 &&
                Objects.equals(zoneId, that.zoneId) &&
                Objects.equals(instanceId, that.instanceId) &&
                Objects.equals(time, that.time) &&
                Objects.equals(algType,that.algType) &&
                Objects.equals(status,that.status);
    }

    public PredictPriceEntity() {
    }

    @Override
    public int hashCode() {
        return Objects.hash(zoneId, instanceId, time, spot,algType,status);
    }

    public PredictPriceEntity(String zoneId, String instanceId, String time, double spot, int algType, int status) {
        this.zoneId = zoneId;
        this.instanceId = instanceId;
        this.time = time;
        this.spot = spot;
        this.algType = algType;
        this.status = status;
    }

    public int getAlgType() {
        return algType;
    }

    public void setAlgType(int algType) {
        this.algType = algType;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }
}
